<%-- 
    Document   : smsType9
    Created on : 11 Jan, 2013, 7:02:06 PM
    Author     : sagar
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@include file="../common/script.jsp" %>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <%@include file="../common/title.jsp" %>

        <script type="text/javascript">
            var rules=new Array();
            rules[0]='centerId|required|please Select centre'; 
            rules[1]='eventDate|required|please Select date'; 
            rules[2]='services|required|please Select service';
        </script>
        <script type="text/javascript">
            $(function() {  
                $( "#eventDate" ).datetimepicker({dateFormat: 'dd-mm-yy',stepMinute:15, hourMin:8,hourMax:21,minDate:0});
            });
        </script>
        <script type="text/javascript">
            
            function selectSms(){
                var id=document.getElementById("centerId");
                var centreInfo = id.options[id.selectedIndex].text;
                var centreName=centreInfo.replace(/[^A-Za-z]+/g, " ");
                var centerContact=centreInfo.replace(/[^0-9+]+/g, " ");
                var date=document.getElementById("eventDate").value;
                var serviceName=document.getElementById("services").value;
                
                var msBody="Dear ${customer.customerName},\n\
Healthspring invites you "+serviceName+" at "+centreName+" on "+date+". We look forward to interacting with you. Please call "+centreName+"centre ("+centerContact+")  for any queries.\n\
Warm Regards\n\
Healthspring";
                    document.getElementById("smsType13").value=msBody;
                
            }        
        </script>
    </head>
    <body onload="selectSms();yav.init('form1',rules,'inline');">
        <%@include file="../common/header.jsp" %>
        <%@include file="../common/menu.jsp" %>
        <div class="in_02">
            <form:form id="form1" name="form1"  method="POST">
                <fieldset style="width:60%;">
                    <legend>Sending SMS For - Outbound Promotion SMS</legend>
                    <table class="formTable">
                        <tr>
                            <td style="padding:5px 30px 1px 5px;"><spring:message code="centerName"/>:<br/>
                                <select  id="centerId" name="centerId"  class="userInputMedium" onchange="selectSms();">
                                    <option value="" label="-"></option>
                                    <c:forEach items="${centerList}" var="list">
                                        <option value="${list.centerId}">${list.centerName} ~ ${list.phoneNumber}</option>
                                    </c:forEach>
                                </select><br/>
                                <span id="errorsDiv_centerId"></span><br/>
                            </td>
                        
                            <td style="padding:5px 30px 1px 5px;">Activity Name:<br/>
                                <select id="services" name="services"  class="userInputMedium" onchange="selectSms();">
                                    <option value=""> - </option>
                                    
                                </select><br/>
                                 <span id="errorsDiv_services"></span>
                            </td>
                        
                            <td style="padding:5px 30px 1px 5px;">Date:<br/>
                                <input name="eventDate" id="eventDate" class="userInputLarge" onchange="selectSms();"/><br/>
                                <span id="errorsDiv_eventDate"></span>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="3"><span class="HeadingForSms"><b>Outbound Promotion SMS</b></span><br/><br/>
                                Message :<br/>
                                <textarea id="smsType13" name="smsType13"  value="${msBody13}" class="TextAreaForSms" readonly="" /></textarea><br/>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <input type="submit" name="_finish"  value="<spring:message code="button.sendSms"/>" onclick="return yav.performCheck('form1', rules, 'inline'); "/>
                                <input type="submit" name="_cancel"  value="<spring:message code="button.Cancel"/>"/> 
                            </td>
                        </tr> 
                    </table>
                </fieldset>
            </form:form>
        </div>
    </body>
</html>
